const path = require('path');
module.exports = {
    mode: 'production',
    entry: './src/index.ts',
    output: {
        filename: 'bundle.umd.js',
        path: path.resolve(__dirname, 'example/js'),
        libraryTarget: "umd",
        globalObject: "this",
        library: "MK"
    },
    module: {
        rules: [
            {
                test: /\.ts$/,
                exclude: /node_modules/,
                loader: "babel-loader",
                options: {
                    presets: [
                        [
                            "@babel/preset-env",
                            {
                                useBuiltIns: "usage",
                                modules: false
                            }
                        ]
                    ],
                    plugins: [
                        [
                            require("@babel/plugin-transform-runtime"),
                            {
                                corejs: false,
                                helpers: true,
                                regenerator: false,
                                useESModules: false,
                            }
                        ]
                    ],
                    comments: false
                }
            },
            {
                test: /\.ts$/,
                use: 'ts-loader',
                exclude: /node_modules/
            }

        ]
    },
    resolve: {
        extensions: ['.tsx', '.ts', '.js']
    }

}